package com.spring.study.bean.definition;

import com.spring.study.bean.factory.UserFactory;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;

public class BeanGarbageCollectionDemo {

    public static void main(String[] args) throws Exception {
        AnnotationConfigApplicationContext applicationContext = new AnnotationConfigApplicationContext();
        //注册bean
        applicationContext.register(BeanInitializationDemo.class);
        //启动上下文
        applicationContext.refresh();
        //关闭上下文
        applicationContext.close();
        System.out.println("spring应用上下文关闭》》》");
        Thread.sleep(5000L);
        //强制触发gc
        System.gc();
        Thread.sleep(5000L);
    }
}
